<template>
  <div v-if="itemsInfo.title" class="PanelGroup">
    <p class="PanelGroup-title">{{ itemsInfo.title }}数据</p>
    <el-row :gutter="40" class="panel-group">
      <el-col :xs="12" :sm="12" :lg="6" class="card-panel-col">
        <div class="card-panel">
          <p class="card-panel-title">累计{{ itemsInfo.title }}数量</p>
          <div class="card-panel-count">
            <span>
              <count-to
                :start-val="0"
                :end-val="parseFloat(itemsInfo.item.statistics.total_num)"
                :duration="3600"
                class="card-panel-num"
              />
            </span>人次
          </div>
        </div>
      </el-col>
      <el-col :xs="12" :sm="12" :lg="6" class="card-panel-col">
        <div class="card-panel card-line">
          <p class="card-panel-title">当日{{ itemsInfo.title }}数量</p>
          <div class="card-panel-count">
            <span>
              <count-to
                :start-val="0"
                :end-val="parseFloat(itemsInfo.item.statistics.num||itemsInfo.item.statistics.today_num)"
                :duration="3600"
                class="card-panel-num"
              />
            </span>人次
          </div>
          <div class="three-line box-between">
            <span>对比上周同期</span>
            <span
              :class="parseInt(itemsInfo.item.statistics.today_num_ratio).length>2?'top':'down'"
            >
              {{ parseInt(itemsInfo.item.statistics.today_num_ratio).length>2?'↑':'↓' }}
              {{ itemsInfo.item.statistics.today_num_ratio }}
            </span>
          </div>
        </div>
      </el-col>
      <el-col :xs="12" :sm="12" :lg="6" class="card-panel-col">
        <div class="card-panel">
          <p class="card-panel-title">累计{{ itemsInfo.title }}金额</p>
          <div class="card-panel-count">
            <span>
              <count-to
                :start-val="0"
                :end-val="parseFloat(itemsInfo.item.statistics.total_fee)"
                :duration="3600"
                class="card-panel-num"
              />
            </span>人次
          </div>
        </div>
      </el-col>
      <el-col :xs="12" :sm="12" :lg="6" class="card-panel-col">
        <div class="card-panel card-line">
          <p class="card-panel-title">当日{{ itemsInfo.title }}金额</p>
          <div class="card-panel-count">
            <span>
              <count-to
                :start-val="0"
                :end-val="parseFloat(itemsInfo.item.statistics.fee||0)"
                :duration="3600"
                class="card-panel-num"
              />
            </span>人次
          </div>
          <div class="three-line box-between">
            <span>对比上周同期</span>

            <span
              :class="parseInt(itemsInfo.item.statistics.today_num_ratio).length>2?'top':'down'"
            >
              {{ parseInt(itemsInfo.item.statistics.today_num_ratio).length>2?'↑':'↓' }}
              {{ itemsInfo.item.statistics.today_fee_ratio }}
            </span>
          </div>
        </div>
      </el-col>
    </el-row>
  </div>
</template>

<script>
import CountTo from 'vue-count-to'

export default {
  components: {
    CountTo
  },
  props: {
    itemsInfo: {
      type: Object,
      default: null
    }
  },
  methods: {}
}
</script>

<style lang="scss" scoped>
.PanelGroup {
  .PanelGroup-title {
    font-size: 22px;
    font-family: PingFang SC;
    font-weight: 400;
    color: #333333;
    margin: 0 0 20px;
    font-weight: bold;
    text-align: center;
    color: #1e68f6;
    position: relative;
    &::after {
      position: absolute;
      content: "";
      top: 50%;
      right: 1%;
      transform: translate(0, -50%);
      width: 40%;
      height: 1px;
      border-top: 1px dotted #1e68f6;
    }
    &::before {
      position: absolute;
      content: "";
      top: 50%;
      left: 1%;
      transform: translate(0, -50%);
      width: 40%;
      height: 1px;
      border-top: 1px dotted #1e68f6;
    }
  }
  .panel-group {
    .card-panel {
      font-size: 12px;
      position: relative;
      overflow: hidden;
      color: #666;
      border-color: rgba(0, 0, 0, 0.05);
      height: 150px;
      background: rgba(255, 255, 255, 1);
      box-shadow: 0px 10px 11px 0px rgba(95, 125, 247, 0.1);
      border-radius: 10px;
      padding: 40px 34px;
      margin-bottom: 10px;
      .card-panel-title {
        font-size: 18px;
        font-family: PingFang SC;
        font-weight: 400;
        color: #333333;
        margin: 0 0 20px;
      }
      .card-panel-count {
        font-size: 18px;
        font-weight: 400;
        color: #333333;
        span {
          font-size: 34px;
          color: #1e68f6;
          line-height: 40px;
          font-weight: bold;
        }
      }
    }
    .card-line {
      padding: 15px 34px;
      .three-line {
        padding-top: 20px;
        font-size: 18px;
        font-weight: 400;
        color: #333333;
        .down {
          color: #e03838;
          padding-left: 5px;
        }
        .top {
          color: #60c36d;
          padding-left: 5px;
        }
      }
    }
  }
}
</style>
